package world;


import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import world.edges.Border;
import world.edges.Door;
import world.placement.Direction;
import world.placement.Position;
import world.square.Rock;
import world.square.Square;

public class ShaftTest {

	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
		xShaft = new Shaft<Square>(Direction.EAST, 40);
		yShaft = new Shaft<Square>(Direction.NORTH, 40);
		zShaft = new Shaft<Square>(Direction.CEILING, 40);


		position1 = new Position (10, 0, 0);
		position2 = new Position (20, 21, 20);
		positionTest = new Position (1, 0, 0);
		normalSquare1 = new Square();
		normalSquare1.addBorders(new Border(new Door(false),Direction.NORTH));
		normalSquare2 = new Square();
		normalSquare3 = new Square();
		rockSquare = new Rock();
		xShaft.addSquare(normalSquare1, position1);
		normalSquare3.addBorders(new Border(new Door(false), Direction.EAST));
		normalSquare2.addBorders(new Border(new Door(false), Direction.WEST));
				
	}
	private static Shaft<Square> xShaft;
	@SuppressWarnings("unused")
	private static Shaft<Square> yShaft;
	@SuppressWarnings("unused")
	private static Shaft<Square> zShaft;


	private static Position position1;
	private static Position position2;
	private static Position positionTest;
	private static Square normalSquare1;
	private static Square normalSquare2;
	private static Square normalSquare3;
	private static Square rockSquare;

	
	

	@Before
	public void setUp() throws Exception {
	}
	
	@Test
	public final void getShaftDirection_SingleCase(){
		assertEquals(Direction.EAST, xShaft.getShaftDirection());
	}
	
	@Test
	public final void canHaveAsPosition_TrueCase(){
		assertTrue(xShaft.canHaveAsPosition(positionTest));
	}
	
	@Test
	public final void canHaveAsPosition_FalseCase(){
		assertFalse(xShaft.canHaveAsPosition(position2));
	}
	
	@Test
	public final void canHaveAsSquare_TrueCase(){
		assertTrue(xShaft.canHaveAsSquare(normalSquare2));
	}
	
	@Test
	public final void canHaveAsSquare_FalseCase(){
		assertFalse(xShaft.canHaveAsSquare(rockSquare));
	}
	
	@Test
	public final void canHaveSquareAtPosition_TrueCase(){
		assertTrue(xShaft.canHaveSquareAtPosition(normalSquare3, new Position(40,0,0)));
	}
	@Test
	public final void canHaveSquareAtPosition_FalseCase(){
		assertFalse(xShaft.canHaveSquareAtPosition(normalSquare2, new Position(0,0,40)));
	}
	@Test
	public final void isBeginningSquare_FalseCase(){
		assertFalse( xShaft.isStartPosition (position1));
	}

}
